Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make WaitForCall extension accept matching calls made before waiting #42

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

rickykaare
Copy link
Collaborator

These improvements will make the .WaitForCall() extension method more useful, as it will recognize calls already made to the substitute and return immediately if there is a match.

Before this change tests using the WaitForCall would need to start the wait early to ensure that all calls were captured regardless of timing. Like this:

var waitTask = substitute.WaitForCall(x => x.CallToWaitFor());

await sut.ExecuteAsync(canellationToken);

await waitTask;

With the changed behavior, the WaitForCall can be called "inline" with the test like this:

await sut.ExecuteAsync(canellationToken);

await substitute.WaitForCall(x => x.CallToWaitFor());

@rickykaare rickykaare merged commit 647395f into main Oct 2, 2024
4 checks passed
@rickykaare rickykaare deleted the feature/wait-for-call branch October 2, 2024 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants